package cn.project.lemontree.bean;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
public class Album  implements Serializable {
    @TableId(type = IdType.AUTO)
    @ApiModelProperty(value = "相册序列号")
    private Integer albumId;
    @TableField(exist = false)
    private Parent parent;
    @TableField(exist = false)
    private Child child;
    @ApiModelProperty(value = "发布时间",hidden = true)
    private String createTime;
    @ApiModelProperty(value = "相册主题")
    private String theme;
    @ApiModelProperty(value = "相册内容")
    private String ddesc;
    @ApiModelProperty(value = "虚拟路径")
    private String vurl;
    @TableLogic
    @ApiModelProperty(hidden = true)
    private Integer deleted;

    public void setParent(Parent parent){
        this.parent = parent;
    }

    public void setParent(Integer parentId,String parentName){
        this.parent.setParentId(parentId);
        this.parent.setParentName(parentName);
    }

    public void setParent(User user) {
        this.parent.setParentId(user.getUserid());
        this.parent.setParentName(user.getUsername());
        this.parent.setTelephone(user.getTelephone());
        this.parent.setPassword(user.getPassword());
    }

    public Album(String theme,String ddesc,Child child,Parent parent){
        this.theme = theme;
        this.ddesc = ddesc;
        this.child = child;
        this.parent = parent;
    }
}
